<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('dict_items', function (Blueprint $table) {
            $table->id()->comment('主键id');
            $table->string('label', 100)->comment('字典项标签');
            $table->string('value', 100)->comment('字典项值');
            $table->tinyInteger('status')->default(1)->comment('状态：0-禁用，1-启用!!');
            $table->integer('sort')->default(0)->comment('排序');
            $table->string('tagType', 50)->nullable()->comment('标签类型(success-成功 warning-警告 info-信息 primary-默认 danger-错误)');
            $table->foreignId('dict_id')->constrained()->onDelete('cascade');
            $table->timestamp('createTime')->nullable()->comment('创建时间（秒级时间戳）');
            $table->timestamp('updateTime')->nullable()->comment('更新时间（秒级时间戳）');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('dict_items');
    }
};
